package com.fernfx.xingtan.common.network.entity;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import okhttp3.Headers;

public class NetworkOKResult implements Serializable {
    private static final long serialVersionUID = 2885738088788312566L;

    private String mMessage = "";

    private Map<String, String> mHeaders;

    /**
     * 这个值只有成功才有实际意义
     */
    private boolean mIsNetworkRequest = true;

    public NetworkOKResult(String message, Headers headers) {
        mMessage = null != message ? message : "";
        if (null != headers) {
            this.mHeaders = new HashMap<>();
            for (String header : headers.names()) {
                this.mHeaders.put(header, headers.get(header));
            }
        }
    }

    public String getMessage() {
        return mMessage;
    }

    public Map<String, String> getHeaders() {
        return mHeaders;
    }

    public boolean isNetworkRequest() {
        return mIsNetworkRequest;
    }

    public void setNetworkRequest(boolean networkRequest) {
        mIsNetworkRequest = networkRequest;
    }
}
